﻿<%@ Page Title="Your Cart" Language="C#" MasterPageFile="~/Bundled.Master" AutoEventWireup="true" CodeBehind="Default.aspx.cs" Inherits="Bundled.Pages.Cart.Default" %>
<asp:Content ID="Content1" ContentPlaceHolderID="head" runat="server">
</asp:Content>
<asp:Content ID="Content2" ContentPlaceHolderID="ContentPlaceHolder1" runat="server">
    <div id="divCart">
        <asp:GridView ID="gvCart" runat="server" AutoGenerateColumns="false" GridLines="Horizontal" CellPadding="20">
            <Columns>
                <asp:BoundField HeaderText="Product" DataField="PartName" ItemStyle-HorizontalAlign="Center" />
                <asp:TemplateField HeaderText="Quantity">
                    <ItemTemplate>
                        <asp:TextBox ID="txtQuantity" runat="server" Text='<%# DataBinder.Eval(Container, "DataItem.Quantity") %>' Width="50" CssClass="alignCenter"></asp:TextBox>
                    </ItemTemplate>
                </asp:TemplateField>
                <asp:TemplateField HeaderText="Cost">
                    <ItemTemplate>
                        <asp:Label ID="lblCost" runat="server" Text='<%# (Convert.ToDecimal(Eval("Price")) * Convert.ToDecimal(Eval("Quantity"))).ToString("c2") %>' ></asp:Label>
                    </ItemTemplate>
                </asp:TemplateField>
                <asp:TemplateField>
                    <ItemTemplate>
                        <asp:Button ID="btnUpdate" runat="server" CommandArgument='<%# Eval("ProductID") + "," + ((GridViewRow) Container).RowIndex %>' OnCommand="btnUpdate_Command" Text="Update" CssClass="button" />
                    </ItemTemplate>
                </asp:TemplateField>
                <asp:TemplateField>
                    <ItemTemplate>
                        <asp:Button ID="btnRemove" runat="server" CommandArgument='<%# Eval("ProductID") %>' OnCommand="btnRemove_Command" Text="Remove Item" CssClass="button" />
                    </ItemTemplate>
                </asp:TemplateField>
            </Columns>
        </asp:GridView>
        <br />
        <div id="divTotals" runat="server">
        <table id="tblCartTotals">
            <tr>
                <td>Subtoal:</td>
                <td><asp:Label ID="lblSubtotal" runat="server"></asp:Label></td>
            </tr>
            <tr>
                <td class="bottomLine">+ Tax:</td>
                <td class="bottomLine"><asp:Label ID="lblTax" runat="server"></asp:Label></td>
            </tr>
            <tr>
                <td>Total:</td>
                <td><asp:Label ID="lblTotal" runat="server"></asp:Label></td>
            </tr>
            <tr>
                <td colspan="2"><asp:Button ID="btnCheckout" runat="server" PostBackUrl="https://www.sandbox.paypal.com/cgi-bin/websc" Text="Checkout with PayPal" CssClass="button" /></td>
            </tr>
        </table>
        </div>
        <div id="divEmpty" runat="server">
            <h2>Cart is empty. Go buy stuff.</h2>
        </div>
    </div>
    <div id="divPayPal" runat="server">
        <input type="hidden" name="cmd" value="_cart" />
        <input type="hidden" name="upload" value="1" />
        <input type="hidden" name="business" value="jsl526_1354752825_per@psu.edu" />
    </div>
</asp:Content>
